Merged
Conversation
Add SchemaBuilder class that provides a chainable API for building index schemas: - .text() - add text field with filterable/full_text_searchable options - .integer() - add integer field with filterable option - .float() - add float field with filterable option - .dense_vector() - add dense vector field with dimension/metric - .sparse_vector() - add sparse vector field - .semantic_text() - add semantic text field with model configuration - .build() - returns the final schema dictionary Closes SDK-102
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| ) | ||
| sys.modules[schema_fields_name] = schema_fields | ||
| with open(schema_fields.__file__) as f: | ||
| exec(compile(f.read(), schema_fields.__file__, "exec"), schema_fields.__dict__) |
There was a problem hiding this comment.
Duplicated module loading logic in test file
Low Severity
The _load_schema_builder_module() function duplicates the schema_fields loading logic (lines 12-27) that already exists in test_schema_fields.py as _load_schema_fields_module(). Both implementations create a module, set its file path, register it in sys.modules, and exec the file contents. This duplicated workaround code increases maintenance burden - if the loading approach needs to change, it must be updated in multiple places.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
SchemaBuilderclass that provides a fluent, chainable API for building index schemas.Closes SDK-102
API
.text(name, ...)filterable,full_text_searchableoptions.integer(name, ...)filterableoption.float(name, ...)filterableoption.dense_vector(name, dimension, metric, ...).sparse_vector(name, ...).semantic_text(name, model, field_map, ...).build()Usage Example
Test Plan
Note
Low Risk
Low risk, additive change that introduces a new helper class and exports it via existing lazy-import/public-module surfaces without modifying request/serialization logic.
Overview
Introduces
SchemaBuilder, a fluent, chainable helper for building indexschemadictionaries from existing field types (TextField,DenseVectorField,SemanticTextField, etc.), including validation that prevents building an empty schema.Exports
SchemaBuilderviapinecone.db_control.modelsand the top-levelpineconelazy imports, and adds focused unit tests for each field type, option serialization, chaining behavior, and overwrite semantics.Written by Cursor Bugbot for commit dd55f6d. This will update automatically on new commits. Configure here.